$(document).ready(function() {
	$("#load-html").click(function() {
		$("#dictionary").load("a.html", {}, function() {
		});
		return false;
	});

	$("#load-json").click(function() {
		$.getJSON("b.json", function(data) {
			$("#dictionary").empty();
			$.each(data, function(entryindex, entry) {
				var html = '<div class="entry">';
				html += '<h3 class="term">'+entry['term']+'</h3>';
				html += '<div class="part">'+entry['part']+'</div>';
				html += '<div class="definition">'+entry['definition'];
				if (entry['quote']) {
					html += '<div class="quote">';
					$.each(entry['quote'], function(lineIndex, line) {
						html += '<div class="quote-line">' + line + '</div>';
					});
					if (entry['author']) {
						html += '<div class="quote-author">' + entry['author'] + '</div>';
					};
					html += '</div>';
				};
				html += '</div>';
				html += '</div>';
				$('#dictionary').append(html);
			});
		});

		return false;
	});

	$('#load-js').click(function() {
		$.getScript('c.js');
	});
});